package com.wiscamp.ninechapters.problems.infrastructure.converters;

import com.wiscamp.ninechapters.problems.domain.models.sets.ProblemSet;
import com.wiscamp.ninechapters.problems.domain.models.sets.SetProblem;
import com.wiscamp.ninechapters.problems.infrastructure.po.sets.ProblemSetPO;
import com.wiscamp.ninechapters.problems.infrastructure.po.sets.ProblemSetView;
import com.wiscamp.ninechapters.problems.infrastructure.po.sets.SetProblemPO;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface ProblemSetConverter {
    ProblemSetConverter Instance = Mappers.getMapper(ProblemSetConverter.class);

    // region problem set
    ProblemSetPO toProblemSetPO(ProblemSet entity);

    ProblemSetPO toProblemSetPO(ProblemSet entity, @MappingTarget ProblemSetPO po);

    ProblemSet toProblemSet(ProblemSetPO po);

    ProblemSet toProblemSetByView(ProblemSetView view);
    // endregion


    // region set problem
    SetProblemPO toSetProblemPO(SetProblem entity);

    SetProblemPO toSetProblemPO(SetProblem entity, @MappingTarget SetProblemPO po);

    SetProblem toSetProblem(SetProblemPO po);
    // endregion
}
